package com.example.demo.rx.cat;

import java.net.URL;
import java.util.List;

public class ApiWrapper2 {
    Api api;
    public void queryCats(String query, Callback<List<Cat>> catsCallback) {
        api.queryCats(query, new Api.CatsQueryCallback() {
            @Override
            public void onCatListReceived(List<Cat> cats) {
                catsCallback.onResult(cats);
            }

            @Override
            public void onQueryFailed(Exception e) {
                catsCallback.onError(e);
            }
        });
    }

    public void store(Cat cat, Callback<URL> callback) {
        api.store(cat, new Api.StoreCallback() {
            @Override
            public void onCatStored(URL url) {
                callback.onResult(url);
            }

            @Override
            public void onStoreFailed(Exception e) {
                callback.onError(e);
            }
        });
    }
}
